<?php

namespace BigVideo\Other\Strategy;


/**
 * 超类，所有的鸭子都继承这个类
 * 抽象显示鸭子的行为：叫和显示
 * Class Duck
 * @package BigVideo\Other\Strategy
 */
abstract class Duck
{
    /**
     * @var FlyingStrategy
     */
    private $flyingStrategy;

    public function quack()
    {
        echo "嘎嘎嘎\n";
    }

    abstract public function display();

    /**
     * @param mixed $flyingStrategy
     */
    public function setFlyingStrategy($flyingStrategy)
    {
        $this->flyingStrategy = $flyingStrategy;
    }

    public function fly()
    {
        $this->flyingStrategy->performFly();
    }

}